package com.lyf.scm.admin.domain.remote.allocationservice;

import com.github.pagehelper.PageInfo;
import com.lyf.scm.admin.api.dto.*;
import com.lyf.scm.admin.api.dto.es.SalesPlanEsEntity;
import com.rome.arch.core.clientobject.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * description:
 * 直营预测计划
 *
 * @author: haodong
 * @data: 2020/8/4 9:49
 */
@FeignClient(name = "scm-plan-service")
public interface SalesPlanDirectlyRemote {

    /**
     * 按条件查询直营预测计划(周)
     *
     * @param salesPlanDirectly
     * @return
     */
    @PostMapping("/api/v1/salesPlanDirectly/list")
    Response<PageInfo<SalesPlanDirectlyReturnDTO>> listPageBySelective(@RequestBody SalesPlanDirectlyDTO salesPlanDirectly);

    /**
     * 查询全部直营预测计划(周)
     *
     * @param salesPlanDirectly
     * @return
     */
    @PostMapping("/api/v1/salesPlanDirectly/listAll")
    Response<List<SalesPlanDirectlyReturnDTO>> listAllByCycles(@RequestBody SalesPlanDirectlyDTO salesPlanDirectly);

    /**
     * 更新确认量
     *
     * @param paramList
     * @return
     */
    @PostMapping("/api/v1/salesPlanDirectly/updateConfirm")
    Response<Boolean> updateConfirm(@RequestBody List<SalesPlanDirectlyDTO> paramList,
                                    @RequestParam("unitType") Long unitType, @RequestParam("level") Integer level);

    /**
     * 导出Excel
     *
     * @param directly
     * @param type
     * @return
     */
    @PostMapping(value = "/api/v1/salesPlanDirectly/export", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Response<List<SalesPlanDirectlyWriteDTO>> exportExcel(@RequestBody SalesPlanDirectlyDTO directly, @RequestParam("type") Integer type);

    @PostMapping("/api/v1/salesPlanDirectly/importExcel")
    Response<Boolean> importVerification(@RequestBody List<SalesPlanDirectlyDTO> directlyWrite);

    /**
     * 删除直营预测——执行对应标识数据
     *
     * @param opSign
     * @return
     */
    @PostMapping("/api/v1/salesPlanDirectly/delete")
    Response delete(@RequestParam("opSign") String opSign);

    /**
     * 动态分组查询
     *
     * @param esQuery
     * @return
     */
    @PostMapping("/api/v1/salesPlanES/queryByGroup")
    Response<PageInfo<EsReturnDTO>> queryByGroup(@RequestBody EsAggregationDTO esQuery);

    /**
     * 分页查询
     *
     * @param esQuery
     * @param pageNum
     * @param pageSize
     * @return
     */
    @PostMapping("/api/v1/salesPlanES/listPageQuery")
    Response<List<SalesPlanEsEntity>> listPageQuery(@RequestBody EsQueryDTO esQuery,
                                                    @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize);
}
